#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<string.h>
int my_strncmp(const char* str1, const char* str2, size_t num)
{
	if (num == 0)
		return 0;
	while (num - 1 && *str1 == *str2)
	{
		num--;
		str1++;
		str2++;
	}
	return (*str1 - *str2);
}
int main()
{
	char a[] = "abcgef";
	char b[] = "abcdef";
	printf("%d", strncmp(a, b, 4));
	return 0;
}